# -*- coding: utf-8 -*-
# @Time : 2024/6/11 9:42 PM 
# @Author : Wayne
# @Email : 1
# @File : kis_app_signature.py
# @Project : young_python_demo
# @DESCRIPTION :
import hmac
import hashlib
import base64
# https://open.jdy.com/#/files/api/detail?index=3&categrayId=dded94c553614747b2c9b8b49c396aa6&id=c26bb0d8171a11eebf32e51b6b676a52
# 无锡华纳
# app_key = "EGcd6ypm"
# appSecret = "3a1b794ced9ba95b37fce84ebf745e61a30c3610"

# 美爵
app_key = "Ew2aIFaH"
appSecret = "cdb429ecf8b0f13635fb9fde28ca3b0602d047da"

# 正确的HMAC-SHA256对象创建及摘要计算
h = hmac.new(appSecret.encode(), app_key.encode(), hashlib.sha256)
digest = h.digest()

# 转换为16进制字符串
hex_digest = digest.hex()

# 进行Base64编码
encoded = base64.b64encode(hex_digest.encode())

# 输出最终结果
print(encoded.decode('utf-8'))